package com.group.lyl.send.service.impl;

import com.group.lyl.send.model.Staff;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 发送邮件
 */
@Service
public class SendMailService {

    @Autowired
    private JavaMailSender javaMailSender;

    public void sendMail(Staff staff) {

        SimpleMailMessage message = new SimpleMailMessage();
        // 设置邮件主题
        message.setSubject("生日祝福");
        message.setFrom("912856565@qq.com");
        message.setTo(staff.getMail());
        //正文
        message.setText("祝你生日快乐"+staff.getName());

        javaMailSender.send(message);
    }
}
